import { extractProductData } from "../utils/jd";
import $ from "jquery";

export default defineContentScript({
  matches: ["https://mall.jd.com/*"],
  runAt: "document_idle",
  main() {
    console.log("Hello content.");

    $(function () {
      const products = $(".jSearchListArea .jItem")
        .map(function () {
          return extractProductData($(this));
        })
        .get();

      console.log("提取到的商品数据:", products);
    });
  },
});
